// 给评论点赞

// const express = require('express');
// const app = express();
const Http = require('../util/request');
const crypto = require('crypto')

module.exports = (query, request) => {
    query.cookies.os = 'pc';
    query.query.t = (query.query.t == 1 ? 'like' : 'unlike');
    query.query.type = {
        0: 'R_SO_4_', //  歌曲
        1: 'R_MV_5_', //  MV
        2: 'A_PL_0_', //  歌单
        3: 'R_AL_3_', //  专辑
        4: 'A_DJ_1_', //  电台,
        5: 'R_VI_62_',//  视频
        6: 'A_EV_2_'  //  动态
    }[query.query.type]
    console.log(query.query)
    const data = {
        threadId: query.query.type + query.query.id,
        commentId: query.query.cid
    }
    Http(
        'POST', `https://music.163.com/weapi/v1/comment/${query.query.t}`, data,
        {crypto: 'weapi', cookie: query.cookies, proxy: query.proxy}
    ).then(res => {
        request.json(res)
    }).catch( err => {
        request.json(err)
    })
};
